Email:
sales@wcscnet.com


Competent Technical Support By Knowledgeable Engineers

View Cart

Checkout

RSS Feed

Home
Products
Services
Support
File Download
Testimonials
NewsLetters
Press Releases
Tutorials
WebLog (News)
WCSC Partners
Developer Tools

Email Updates

Wires No More!


$159.99 a pair
Wireless Serial Adapter
(Bluetooth to RS232)

 

Bluetooth USB Mini Micro Dongle (v2.0, EDR, Class1)
$19.99

Bluetooth USB Dongle
(Class 1, EDR, v2.0)




Credit Card Merchant Services

Improve compatibility between COMM-DRV's internal message loop and MFC Window messaging and buttons.
[All versions]

The secondary message loop used in COMM-DRV/Lib is Win32 specific. Improved integration with MFC can be accomplished by doing the following.

  1. After opening the serial port, use CdrvSetTimeOutFunction() to setup a callback on all COMM-DRV/Lib callbacks.

//Forward definition of function to prevent undeclared identifier error
int TimeoutFunction(int Port);

//Set timeout function that will cause prompt aborting of functions
CdrvSetTimeoutFunction(m_Port,TimeoutFunction);

//Prevent COMM-DRV/Lib's PeekMessage loop from being called. It will be done in
//the TimeoutFunction() to be MFC compliant.
SetSpecialBehavior(m_Port,SB_DoNotCall2ndMsgLoop,CDRV_TRUE,0);

 

  1. Setup the callback function to handle MFC message handling.

//****************************************************************************
//*=====TimeoutFunction()
//*When installed by CdrvSetTimeoutFunction(), this function will
//*be called periodically whenever any COMM-DRV/Lib function is
//*block (waiting for data or waiting to send data). This function
//*returns 0 if it wants to effect a timeout on the function that is
//*blocked or 1 to do nothing.
//*
//*A PeekMessage is added below to supercede the PeekMessage
//*loop built into COMM-DRV/Lib since this method below is what
//*Microsoft recommends for an MFC PeekMessage loop. Note that
//*the COMM-DRV/Lib PeekMessage loop should be disabled with
//*SetSpecialBehavior(m_Port,SB_DoNotCall2ndMsgLoop,
//*CDRV_TRUE,0).
//****************************************************************************
int TimeoutFunction(int Port)
{
CForcedAbortDlg *p = (CForcedAbortDlg *)CdrvGetContext(Port,0);

MSG msg;
::PeekMessage(&msg,NULL,0,0,PM_NOREMOVE);
if (!AfxGetThread()->PumpMessage())
    ::PostQuitMessage(0);

// let MFC do its idle processing
LONG lIdle = 0;
while (AfxGetApp()->OnIdle(lIdle++));

return(1);
}
//****************************************************************************

 

Updated: 08/14/2011 

Copyright © 2011 Willies Computer Software Co